<?php

/*
 *    Document   : images
 *   Created on : Jun 11, 2011, 3:32:21 PM
 *    Author     : ClarkT AKA FalleN
 *    Company    : Amodity
 *    Web        : http://www.amodity.com
 *    Copyright  : 2011
 */

/**

 * @property CI_Loader $load

 * @property CI_Form_validation $form_validation

 * @property CI_Input $input

 * @property CI_Email $email

 * @property CI_DB_active_record $db

 * @property CI_DB_forge $dbforge

 *  @property CI_Session $session

 * @property CI_FTP $ftp

 */

class Images extends CI_Controller {

    public function __construct() {
        parent::__construct();
        $this->load->library('auth');
        $this->load->model('admin/core');
        $this->core->_prev_url();
        $this->load->helper('config_file');
    }

    public function index() {
        //is user logged in
        $this->core->_is_logged_in();

        $this->load->model('admin/images_model', 'images');
        $getimages = $this->images->get_images();

        $data = array(
            'title' => lang('admin_manage_images'),
            'main_content' => 'admin/image_management',
            'page_title' => lang('admin_manage_images'),
            'table' => $this->table->generate()
        );
        $this->template->set('title', lang('admin_manage_images'));
        $this->template->set('page_title', lang('admin_manage_images'));
        $this->template->load('templates/admin_template', 'images', $data, 'admin');
    }

    function delete_image($image_id) {
        //is user logged in
        $this->core->_is_logged_in();

        $this->load->model('admin/images_model', 'images');
        $this->images->delete_image($image_id);
        redirect('admin/images');
    }

}

?>